<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>用户管理</title>
    <%@ include file="../../common/meta.jsp" %>
    <%@ include file="../../common/common-body.jsp" %>
    <link href="${ctx}/css/page/common-list.css?t=${now}" rel="stylesheet">
    <link href="${ctx}/css/page/common-search.css?t=${now}" rel="stylesheet">
</head>
<style>
    a:link {
        font-size: 12px;
        color: #686b6d;
        text-decoration: none;
    }

    a:visited {
        font-size: 12px;
        color: #686b6d;
        text-decoration: none;
    }

    a:hover {
        font-size: 12px;
        color: #686b6d;
        text-decoration: none;
    }

    tr.selected {
        background-color: red !important;
    }

    tr-success {
        background-color: red !important;
    }
</style>
<script>
    var freezeStatusEnumMap = '${freezeStatusEnumMap}';
    var userTypeEnumMap = '${userTypeEnumMap}';
    var roleList = '${roleList}';
    var searchobj = ${dto};
</script>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight" id="vueObj">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5><i class="fa fa-search"></i> 筛选查询</h5>
                </div>
                <div class="ibox-content ibox-content-search">
                    <form class="form-horizontal m-t" id="searchForm" novalidate="novalidate"
                          action="${ctx}/pfUser/getGridData" method="post">
                        <div class="form-group">
                            <div class="col-sm-2">
                                <select id="selectType" name="selectType" class="form-control"
                                        onchange="changeSearch();">
                                    <option value="userName"  ${not empty dto.selectType && dto.selectType == 'userName' ? 'selected' : '' }>
                                        账号
                                    </option>
                                    <option value="telephone" ${not empty dto.selectType && dto.selectType == 'telephone' ? 'selected' : '' }>
                                        手机号
                                    </option>
                                    <option value="realName"  ${not empty dto.selectType && dto.selectType == 'realName' ? 'selected' : '' }>
                                        姓名
                                    </option>
                                </select>
                            </div>
                            <div class="col-sm-4">
                                <input type="text" id="searchKey"
                                <c:choose>
                                <c:when test="${not empty dto.selectType && dto.selectType == 'telephone'}">
                                       name="telephone"
                                       value="${not empty dto.telephone ?dto.telephone:'' }"
                                       placeholder="输入手机号"
                                </c:when>
                                <c:when test="${not empty dto.selectType && dto.selectType == 'realName'}">
                                       name="realName"
                                       value="${not empty dto.realName ?dto.realName:'' }"
                                       placeholder="输入姓名"
                                </c:when>
                                <c:otherwise>
                                       name="userName"
                                       value="${not empty dto.userName ?dto.userName:'' }"
                                       placeholder="输入账号"
                                </c:otherwise>
                                </c:choose>
                                       class="form-control" onkeydown="if(event.keyCode==13){doRefresh();return false;}"
                                       maxlength="30">
                            </div>
                            <label class="col-sm-1 control-label">角色：</label>
                            <div class="col-sm-2">
                                <div class="col-sm-12">
                                    <input type="text" id="roleId" class="hideItem" name="roleId"
                                           value="${not empty dto.roleId ? dto.roleId : ''}"
                                    >
                                    <input type="text" id="roleName" name="roleName" class="form-control"
                                           placeholder="请输入角色名称"
                                    <%--value="${not empty dto.roleName ? dto.roleName : ''}"--%>
                                           v-model="roleName"
                                    >
                                    <div class="input-group-btn" style="width: 1px;float: right!important;">
                                        <button type="button" class="btn btn-default dropdown-toggle mySearchBtn"
                                                data-toggle="dropdown">
                                            <span class="caret"></span>
                                        </button>
                                        <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                        </ul>
                                    </div>
                                </div>
                            </div>

                            <div class="ibox-tools ibox-tools-search">
                                <button type="button" class="btn btn-primary btn-outline" onclick="doRefresh()">查询
                                </button>
                                <button type="button" class="btn btn-primary btn-outline" onclick="doReset()">重置
                                </button>
                                <button type="button" class="btn btn-primary btn-outline" onclick="openSearchTools();">
                                    <i class="fa fa-caret-down"></i></button>
                            </div>

                        </div>
                        <div class="search-tools">
                            <div class="form-group">
                                <c:if test="${ userType == 'super' || userType == 'sysadmin'}">
                                    <label class="col-sm-1 control-label">管理员类型：</label>
                                    <div class="col-sm-2">
                                        <select class="form-control" name="userType" id="userType"
                                                onchange="doRefresh()">
                                            <option value="">--请选择--</option>
                                            <c:forEach items="${userTypeEnumMap}" var="item">
                                                <option value="${item.key}"  ${not empty dto.userType && dto.userType == item.key ? 'selected' : '' }>${item.value}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                </c:if>
                                <label class="col-sm-1 control-label">账号状态：</label>
                                <div class="col-sm-2">
                                    <select class="form-control" name="status" id="status"
                                            onchange="doRefresh()">
                                        <option value="">--请选择--</option>
                                        <c:forEach items="${freezeStatusEnumMap}" var="item">
                                            <c:if test="${item.key!='delete'}">
                                                <option value="${item.key}" ${not empty dto.status && dto.status == item.key ? 'selected' : '' } >${item.value}</option>
                                            </c:if>
                                        </c:forEach>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5><i class="fa fa-table"></i> 账号信息</h5>
                    <div class="ibox-tools col-sm-offset-4">
                        <c:if test="${userType == 'super' || not empty btnMap['addUser']}">
                            <button class="btn btn-primary btn-outline" onclick="openEditPage('add')">新建</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['editUser']}">
                            <button class="btn btn-primary btn-outline" onclick="openEditPage('edit')">编辑</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['stateUser']}">
                            <button class="btn btn-primary btn-outline change_text" onclick="changeState()">恢复</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['delUser']}">
                            <button class="btn btn-primary btn-outline" onclick="deleteUser()">删除</button>
                        </c:if>
                        <button class="btn btn-primary btn-outline" onclick="doRefresh()">刷新</button>
                    </div>
                </div>
                <div class="ibox-content ibox-content-table">
                    <table data-toggle="table" id="dataTable" data-height="400"
                           data-pagination="true" data-side-pagination="server" data-striped="true"
                           data-url="${ctx}/pfUser/getGridData?t=${now}" data-response-handler="handleServerResult"
                           data-query-params-type="" data-query-params="getParams"
                           data-cache="true"
                           data-page-number="${not empty dto.pageNo ? dto.pageNo : 1}"
                           data-page-size="10" data-page-list="${pageList}">
                        <thead>
                        <tr>
                            <th data-field="isvPid" data-visible="false">isvPid</th>
                            <th data-field="status" data-formatter="formatStatus" data-width="80px" data-align="center">
                                状态
                            </th>
                            <th data-field="userName" data-align="center" data-formatter="formatName"
                                data-events="actionEvents">账号
                            </th>
                            <th data-field="realName" data-align="center">姓名</th>
                            <th data-field="telephone" data-align="center">手机号码</th>
                            <th data-field="userType" data-width="100px" data-align="center"
                                data-formatter="formatUserType">管理员类型
                            </th>
                            <th data-field="isvName" data-align="center" data-formatter="formatIsv" data-events="actionEvents">服务商</th>
                            <th data-field="operator" data-width="120px" data-align="center"
                                data-formatter="formatterCreator" data-events="actionEvents">创建人
                            </th>
                            <th data-field="operator" data-width="120px" data-align="center"
                                data-formatter="formatterOperator" data-events="actionEvents">编辑人
                            </th>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <div class="text-center">${companyName}</div>
        </div>
    </div>
</div>


<script src="${ctx}/js/sys/user/pfUserMgr.js?t=${now}"></script>
</body>
</html>
